package com.shuang.controller;

import com.shuang.pojo.ClazzStudentObtion;
import com.shuang.pojo.JobOption;
import com.shuang.pojo.Result;
import com.shuang.service.EmpService;
import com.shuang.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@Slf4j
@RequestMapping("/report")
public class ReportController {

    @Autowired
    private ReportService reportService;

    /*
    * 统计各个职位的员工人数
    * */
    @GetMapping("/empJobData")
    public Result getEmpJobData(){
        log.info("统计各个职位的员工人数");
        JobOption jobOption = reportService.getEmpJobData();
        return Result.success(jobOption);
    }

    /*统计员工性别人数*/
    @GetMapping("/empGenderData")
    public Result getEmpGenderData(){
        log.info("统计员工性别人数");
        List<Map<String, Object>> empGenderDataList = reportService.getEmpGenderData();
        return Result.success(empGenderDataList);
    }

    /*统计班级学员人数*/
    @GetMapping("/studentCountData")
    public Result getClazzStudentData(){
        log.info("统计班级学员人数");
        ClazzStudentObtion clazzStudentObtion = reportService.getClazzStudentData();
        return Result.success(clazzStudentObtion);
    }

    /*统计学员学历信息*/
    @GetMapping("studentDegreeData")
    public Result getStudentDegreeData(){
        log.info("统计学员学历信息");
        List< Map<String, Object> > studentDegreeDataList = reportService.getStudentDegreeData();
        return Result.success(studentDegreeDataList);
    }

}
